/**
 * 
 */
package org.whereiswally.model;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.Serializable;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;

import org.apache.commons.io.IOUtils;
import org.apache.log4j.Logger;

/**
 * @author lgiavedoni
 * 
 */
public class Wally implements Serializable {

    private static Logger logger = Logger.getLogger(Wally.class);

    private String name = "wally";
    private List<byte[]> faces = new ArrayList<byte[]>();

    public String getName() {
	return name;
    }

    public void setName(String name) {
	this.name = name;
    }

    public List<byte[]> getFaces() {
	return faces;
    }

    public void setFaces(List<byte[]> faces) {
	this.faces = faces;
    }

    public void addFace(URI face) {
	try {
	    logger.debug("Agregando cara para: " + getName() + ": " + face);
	    faces.add(IOUtils.toByteArray(new FileInputStream(new File(face))));
	} catch (FileNotFoundException e) {
	    logger.error(e);
	} catch (IOException e) {
	    logger.error(e);
	}
    }

}
